﻿using System.Drawing;
using System.Windows.Forms;
namespace WenSkin.Controls
{
    public class WenGroupBox : GroupBox
    {
        public WenGroupBox() : base()
        {
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            using Brush brush = new SolidBrush(this.ForeColor);
            e.Graphics.Clear(this.BackColor);
            e.Graphics.DrawString(this.Text, this.Font, brush, 10, 1);
            using Pen pen = new Pen(brush);
            e.Graphics.DrawLine(pen, 1, 7, 8, 7);
            e.Graphics.DrawLine(pen, e.Graphics.MeasureString(this.Text, this.Font).Width + 8 + 2, 7, this.Width - 2, 7);

            e.Graphics.DrawLine(pen, 1, 7, 1, this.Height - 2);
            e.Graphics.DrawLine(pen, 1, this.Height - 2, this.Width - 2, this.Height - 2);
            e.Graphics.DrawLine(pen, this.Width - 2, 7, this.Width - 2, this.Height - 2);
        }
    }
}
